
import java.net.*;

public class Event {

   public static final int EVENT_NONE = 0;
   public static final int EVENT_ADD = 1;
   public static final int EVENT_REM = 2;
   public static final int EVENT_OTHER_HOST_TIMER = 3;
   public static final int EVENT_VOTE = 4;

   private InetAddress addr = null;
   private int port = 0;
   private int type = EVENT_NONE;

   public Event() {
   }
   
   public Event( int eventType ) {
      this.type = eventType;
   }

   public int getType() {
      return this.type;
   }

   public InetAddress getAddr() {
      return this.addr;
   }

   public int getPort() {
      return this.port;
   }
   
   /** 
    * @brief 
    * 
    * @param addr 
    * @param port 
    * @param eventType - type of event from above @see EVENT_ADD, @see EVENT_REM
    * 
    * @return 
    */
   public Event( InetAddress addr, int port, int eventType ) {
      this.addr = addr;
      this.port = port;
      this.type = eventType;
   }

   public String toString() {
      return "<Event addr="+addr+", port="+port+">";
   }

   public boolean equals( Event lhs ) {
      if( addr.equals(lhs.addr) && port == port ) {
         return true;
      }
      return false;
   }

}
